import React, { useEffect, useState, useRef } from 'react';
import Router, { withRouter } from '@/router/renderRouter';
import ChildAccount from './ChildAccount'
import List from './List'
import RoleEdit from './RoleEdit'

const Role = (props) => {
  const indexRef = useRef(null)
  const childAccountRef = useRef(null)
  
  const [pageType, setPageType] = useState('list');
  const [params, setParams] = useState(null);
  
  return (
    <>
      <div>
        {
          pageType === 'list'
          ?
          <List ref={indexRef} setParams={setParams}  setPageType={setPageType}  />
          :
          ''
        }
        {
          pageType === 'childAccount'
          ?
          <ChildAccount ref={childAccountRef} params={params} setParams={setParams}  setPageType={setPageType}  />
          :
          ''
        }
        {
          pageType === 'roleEdit'
          ?
          <RoleEdit ref={childAccountRef} params={params} setParams={setParams}  setPageType={setPageType}  />
          :
          ''
        }
        
      </div>
    </>
  )
}
export default withRouter(Role)